/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package in.jquickfinder.models;

import java.io.File;
import java.util.ArrayList;
import javax.swing.event.TableModelListener;
import javax.swing.table.TableModel;

/**
 *
 * @author Administrator
 */
public class CustomizedTableModel implements TableModel {

    private ArrayList<File> filePathList;
    private String columnNames[] = {"File Name", "File Path"};
    private Class classNames[] = {String.class, String.class};

    public CustomizedTableModel(ArrayList<File> filePathList) {
        this.filePathList = filePathList;
    }

    @Override
    public int getRowCount() {
        return filePathList.size();
    }

    @Override
    public int getColumnCount() {
        return columnNames.length;
    }

    @Override
    public String getColumnName(int columnIndex) {
        return columnNames[columnIndex];
    }

    @Override
    public Class<?> getColumnClass(int columnIndex) {
        return classNames[columnIndex];
    }

    @Override
    public boolean isCellEditable(int rowIndex, int columnIndex) {
        return false;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        File file = filePathList.get(rowIndex);
        switch (columnIndex) {
            case 0:
                return file.getName();

            case 1:
                return file.getPath();
        }
        return null;
    }


    @Override
    public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
    }

    @Override
    public void addTableModelListener(TableModelListener l) {
    }

    @Override
    public void removeTableModelListener(TableModelListener l) {
    }
}
